package com.codeZ.AdapterPattern.objectAdapter;

import com.codeZ.AdapterPattern.SDCard;
import com.codeZ.AdapterPattern.TFCard;
import lombok.Data;

/**
 * 对象适配器 TF卡的实现类
 *
 * @author codeZhang
 * @Date 2024/8/14 14:05
 */
@Data
public class SDCardAdapterTF implements SDCard {

    private TFCard tfCard;

    public SDCardAdapterTF(TFCard tfCard) {
        this.tfCard = tfCard;
    }

    @Override
    public String read() {
        System.out.println("adapter read tf card ");
        return tfCard.read();
    }

    @Override
    public void write(String data) {
        System.out.println("adapter write tf card");
        tfCard.write(data);
    }
}
